<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>实验管理系统
    </title>
    <link rel='stylesheet prefetch' href="stylesheets\style1.css">
    <link rel="stylesheet" href="stylesheets\style.css">
</head>

<body screen_capture_injected="true">
    <div>
        <h1 class="h1">实验管理系统</h1>
        <h2 class="h2">Copyright © 2017 版权归我们所有</h2>
        <div class="hr">
            <hr style=" background-color:black; height:1px" />
        </div>
        <div class="hr1">
            <hr style=" background-color:black; height:1px" />
        </div>
        <div class="wrapper">
            <h2 style="font-size:18px">请登录</h2>
            <br>
            <input type="text" id="username" class="form-control" name="username" placeholder=<%- message1 %> />
            <br>
            <input type="password" id="password" class="form-control" name="password" placeholder=<%- message2 %> />
            <br>
            <button class="btn btn-lg btn-primary btn-block" type="submit" id="log1">登录</button>
        </div>
    </div>
    <script type="text/javascript" src="javascripts/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#log1").click(function () {
                var username = $("#username").val();
                var password = $("#password").val();
                var data = { "uname": username, "upwd": password };
                $.ajax({
                    url: '/index',
                    type: 'post',
                    data: data,
                    success: function (data) {
                        if (data == 'iamadmin') {
                            // alert(data)
                            location.href = 'admin';
                        } else if (data == 'iamstudent') {
                            location.href = 'student';
                        } else if (data == 'iamteacher') {
                            location.href = 'teacher';
                        }
                    },
                    error: function (data, status) {
                        if (status == 'error') {
                            location.href = 'index';
                        }
                    }
                });
            });
        });
    </script>
</body>

</html>